package org.yaac.server.delegate;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;

import org.yaac.shared.SharedConstants;

import com.google.appengine.api.memcache.AsyncMemcacheService;
import com.google.appengine.api.memcache.ErrorHandler;
import com.google.appengine.api.memcache.Expiration;
import com.google.appengine.api.memcache.MemcacheService.IdentifiableValue;
import com.google.appengine.api.memcache.MemcacheService.SetPolicy;
import com.google.appengine.api.memcache.MemcacheServiceFactory;
import com.google.appengine.api.memcache.Stats;

public class AsyncMemcacheServiceDelegateImpl implements AsyncMemcacheServiceDelegate {

	private AsyncMemcacheService getService() {
		return MemcacheServiceFactory.getAsyncMemcacheService(SharedConstants.NAMESPACE);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#clearAll()
	 */
	@Override
	public Future<Void> clearAll() {
		return getService().clearAll();
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#contains(java.lang.Object)
	 */
	@Override
	public Future<Boolean> contains(Object arg0) {
		return getService().contains(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#delete(java.lang.Object, long)
	 */
	@Override
	public Future<Boolean> delete(Object arg0, long arg1) {
		return getService().delete(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#delete(java.lang.Object)
	 */
	@Override
	public Future<Boolean> delete(Object arg0) {
		return getService().delete(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#deleteAll(java.util.Collection, long)
	 */
	@Override
	public <T> Future<Set<T>> deleteAll(Collection<T> arg0, long arg1) {
		return getService().deleteAll(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#deleteAll(java.util.Collection)
	 */
	@Override
	public <T> Future<Set<T>> deleteAll(Collection<T> arg0) {
		return getService().deleteAll(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#get(java.lang.Object)
	 */
	@Override
	public Future<Object> get(Object arg0) {
		return getService().get(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#getAll(java.util.Collection)
	 */
	@Override
	public <T> Future<Map<T, Object>> getAll(Collection<T> arg0) {
		return getService().getAll(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#getErrorHandler()
	 */
	@Override
	public ErrorHandler getErrorHandler() {
		return getService().getErrorHandler();
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#getIdentifiable(java.lang.Object)
	 */
	@Override
	public Future<IdentifiableValue> getIdentifiable(Object arg0) {
		return getService().getIdentifiable(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#getNamespace()
	 */
	@Override
	public String getNamespace() {
		return getService().getNamespace();
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#getStatistics()
	 */
	@Override
	public Future<Stats> getStatistics() {
		return getService().getStatistics();
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#increment(java.lang.Object, long, java.lang.Long)
	 */
	@Override
	public Future<Long> increment(Object arg0, long arg1, Long arg2) {
		return getService().increment(arg0, arg1, arg2);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#increment(java.lang.Object, long)
	 */
	@Override
	public Future<Long> increment(Object arg0, long arg1) {
		return getService().increment(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#incrementAll(java.util.Collection, long, java.lang.Long)
	 */
	@Override
	public <T> Future<Map<T, Long>> incrementAll(Collection<T> arg0, long arg1, Long arg2) {
		return getService().incrementAll(arg0, arg1, arg2);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#incrementAll(java.util.Collection, long)
	 */
	@Override
	public <T> Future<Map<T, Long>> incrementAll(Collection<T> arg0, long arg1) {
		return getService().incrementAll(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#incrementAll(java.util.Map, java.lang.Long)
	 */
	@Override
	public <T> Future<Map<T, Long>> incrementAll(Map<T, Long> arg0, Long arg1) {
		return getService().incrementAll(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#incrementAll(java.util.Map)
	 */
	@Override
	public <T> Future<Map<T, Long>> incrementAll(Map<T, Long> arg0) {
		return getService().incrementAll(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#put(java.lang.Object, java.lang.Object, com.google.appengine.api.memcache.Expiration, com.google.appengine.api.memcache.MemcacheService.SetPolicy)
	 */
	@Override
	public Future<Boolean> put(Object arg0, Object arg1, Expiration arg2, SetPolicy arg3) {
		return getService().put(arg0, arg1, arg2, arg3);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#put(java.lang.Object, java.lang.Object, com.google.appengine.api.memcache.Expiration)
	 */
	@Override
	public Future<Void> put(Object arg0, Object arg1, Expiration arg2) {
		return getService().put(arg0, arg1, arg2);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#put(java.lang.Object, java.lang.Object)
	 */
	@Override
	public Future<Void> put(Object arg0, Object arg1) {
		return getService().put(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#putAll(java.util.Map, com.google.appengine.api.memcache.Expiration)
	 */
	@Override
	public Future<Void> putAll(Map<?, ?> arg0, Expiration arg1) {
		return getService().putAll(arg0, arg1);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#putAll(java.util.Map)
	 */
	@Override
	public Future<Void> putAll(Map<?, ?> arg0) {
		return getService().putAll(arg0);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#putAll(java.util.Map, com.google.appengine.api.memcache.Expiration, com.google.appengine.api.memcache.MemcacheService.SetPolicy)
	 */
	@Override
	public <T> Future<Set<T>> putAll(Map<T, ?> arg0, Expiration arg1, SetPolicy arg2) {
		return getService().putAll(arg0, arg1, arg2);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#putIfUntouched(java.lang.Object, com.google.appengine.api.memcache.MemcacheService.IdentifiableValue, java.lang.Object, com.google.appengine.api.memcache.Expiration)
	 */
	@Override
	public Future<Boolean> putIfUntouched(Object arg0, IdentifiableValue arg1, Object arg2, Expiration arg3) {
		return getService().putIfUntouched(arg0, arg1, arg2, arg3);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#putIfUntouched(java.lang.Object, com.google.appengine.api.memcache.MemcacheService.IdentifiableValue, java.lang.Object)
	 */
	@Override
	public Future<Boolean> putIfUntouched(Object arg0, IdentifiableValue arg1, Object arg2) {
		return getService().putIfUntouched(arg0, arg1, arg2);
	}

	/* (non-Javadoc)
	 * @see org.yaac.server.delegate.AsyncMemcacheServiceDelegate#setErrorHandler(com.google.appengine.api.memcache.ErrorHandler)
	 */
	@Override
	public void setErrorHandler(ErrorHandler arg0) {
		getService().setErrorHandler(arg0);
	}
	
	
}
